<template>
	<div class="asking">
		<div class="title">
			{{loadData.name}}
		</div>
		<van-divider />
		<div class="content">
			<div class="list">
				<div class="title">问题标题</div>
				<van-cell-group>
					<van-field v-model="title" placeholder="单行输入" :border='false' />
				</van-cell-group>
			</div>
			<div class="list">
				<div class="title">问题描述</div>
				<quill-editor class="editor" v-model="postcontent" ref="myQuillEditor"></quill-editor>
			</div>
		
		</div>
		<div class="button-sub">
			<van-button type="primary" block color="#FE7700" round @click="editData">提交</van-button>
		</div>
	</div>
</template>

<script>
	import showimg from "@/assets/img/showimg.png"
	export default {
		name: "asking",
		components: {

		},
		data() {
			return {
				showimg:showimg,
				loadData:{},
				title:'',
				postcontent:'',
				userInfo:{}
			}
		},
		mounted() {
			this.loadData = this.$localStorage.get("secondLevel")
			this.userInfo = JSON.parse(this.$getcookie("userInfo"))
		},
		methods:{
			detail(item){
				this.$router.push({name:'askdetail',query:{id:item.id}})
			},
			editData(){
				let askData = {
					user_id: this.userInfo.user_id,
					token: this.$getcookie("jy_token"),
					site_id: this.$getcookie("site_id")||0,
					title:this.title,
					postcontent:this.postcontent
				}
				this.$api.home.addAsking(askData).then(res => {
					// 执行某些操作
					if (res.code == 1) {
						this.$toast.success(res.msg)
					} else {
						this.$toast.fail(res.msg)
					}
							
				})
			}
		}


	}
</script>

<style scoped lang="less">
	.asking {
		padding: 1.13rem 0.78rem;
		background: #fff;

		.title {
			font-size: 0.94rem;
			font-family: PingFang SC;
			font-weight: bold;
			color: rgba(38, 38, 38, 1);
		}

		.content {
			margin-top: 0.59rem;
			background: #fff;
			padding: 0 1.81rem;
		
			.list {
				margin-bottom: 1.47rem;
		
				.title {
					font-size: 0.88rem;
					font-family: PingFang SC;
					font-weight: 500;
					color: rgba(74, 74, 74, 1);
					margin-bottom: 0.84rem;
				}
		
				.van-cell {
					width: 17.06rem;
					height: 2.56rem;
					border: 1px solid rgba(191, 191, 191, 1);
					border-radius: 0.5rem;
					line-height: 1;
				}
		
				.van-hairline--top-bottom::after,
				.van-hairline-unset--top-bottom::after {
					display: none;
				}
			}
		}
	}
</style>
